package ru.braim.weather_app.repositories;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import ru.braim.weather_app.models.Account;

import java.util.List;
import java.util.Optional;

@Repository
public interface AccountRepository extends JpaRepository<Account, Integer> {
    boolean existsByEmail(String email);

    Optional<Account> findByEmail(String email);

    boolean existsAccountByCookie(String cookie);

    Page<Account> getAccountByFirstNameContainingIgnoreCaseAndLastNameContainingIgnoreCaseAndEmailContainingIgnoreCase
            (String firstName, String lastName, String email, Pageable pageable);

    Account getAccountByCookie(String cookie);

}
